const express = require('express');
const router = express.Router();
const session = require('express-session');

const MySQLStore = require('connect-mysql')(session);
router.use(session({
    secret: 'zheng',
    name: "session",
    resave: false,
    saveUninitialized: true,
    cookie: { maxAge: 1000 * 60 * 60 * 24, secure: false },
    rolling: true, //每次请求时重新设置cookie缓存时间
    store: new MySQLStore({
        secret: 'zhengy',
        config: {
            user: 'root',
            password: 'root',
            database: 'v_node'
        }

    })
}))

module.exports = router